short int convert_adc2temperature(
   short int ax,
   short int a0,short int a1,
   short int temp0,short int temp1);

void setup() {

  Serial.begin(9600);
}

void loop() {

   int sensorValue = analogRead(A0);
   short int ax = sensorValue;
   short int a0 = 815;
   short int a1 = 397;
   short int temp0 = 10;
   short int temp1 = 60;

   short int tempx = convert_adc2temperature(ax, a0, a1, temp0, temp1);
   Serial.println(tempx);
   delay(1000);
}
short int convert_adc2temperature(
   short int ax,
   short int a0,short int a1,
   short int temp0,short int temp1)
{
   short int tempx;
   tempx = temp0+(ax-a0)*(temp1-temp0)/(a1-a0);
   return tempx;
}
